const fs = require('fs');
fs.readFileSync('./static/json.json');
console.log('Success');

// 分别在不同目录下运行不同node命令，得到的结果如下
/*
PS D:\WorkSpace\WorkSpace_My\NodeJS\2_NodeJS\NodeJS路径处理\1.路径问题> node .\main.js
Success
 */

/*
PS D:\WorkSpace\WorkSpace_My\NodeJS\2_NodeJS\NodeJS路径处理> node .\1.路径问题\main.js
node:internal/fs/utils:345
    throw err;
    ^

Error: ENOENT: no such file or directory, open './static/json.json'
    at Object.openSync (node:fs:585:3)
    at Object.readFileSync (node:fs:453:35)
    at Object.<anonymous> (D:\WorkSpace\WorkSpace_My\NodeJS\2_NodeJS\NodeJS路径处理\1.路径问题\main.js:3:4)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
    at node:internal/main/run_main_module:17:47 {
  errno: -4058,
  syscall: 'open',
  code: 'ENOENT',
  path: './static/json.json'
}
 */